<template>
    <BNavbar toggleable="lg" variant="light" v-b-color-mode="'light'">
        <BNavbarBrand to="/">{{ brandTitle() }}</BNavbarBrand>
        <BNavbarToggle target="nav-collapse" />
        <BCollapse id="nav-collapse" is-nav>
            <BNavbarNav>
                <BNavItem to="/Projects">Проекты</BNavItem>
                <BNavItem to="/Tags" v-if="isAuth">Тэги</BNavItem>
            </BNavbarNav>
            <!-- Right aligned nav items -->
            <BNavbarNav class="ms-auto mb-2 mb-lg-0">
                <BNavItem v-if="isAuth" @click="relog">Выйти</BNavItem>
            </BNavbarNav>
        </BCollapse>
    </BNavbar>
</template>

<script>
export default {
    props: {
        isAuth: {
            type: Boolean,
            required: true
        }
    },
    methods: {
        relog() {
            this.$store.commit('relogin');
            this.$cookies.remove('token');
            this.$router.push("/");
        },
        brandTitle() {
            return this.isAuth ? "ChikovMF Admin" : "ChikovMF"
        }
    },
} 

</script>

<style lang="scss" scoped></style>